<%@ page import="br.com.zanictech.grails.broker.Servidor" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'servidor.label', default: 'Servidor')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-servidor" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div id="list-servidor" class="content scaffold-list" role="main">
			<h1><g:message code="default.list.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<div id="servidoresExecutando">
				<g:render template="list" ></g:render>
			</div>
			<div class="pagination">
				<g:paginate total="${servidorInstanceTotal}" />
			</div>
		</div>
		
		<script type="text/javascript">
		
			function startstop(servidorId, opcao) {

				$.ajax({
					url: url = "${createLink([absolute: true, controller: 'servidor', action: 'startstop'])}",
	                type: 'post',
	                dataType: 'json',
	                async: false,                 
					data: {'servidorId': servidorId, 'opcao': opcao},
					success: function(resultado){
						$('#servidoresExecutando').html(resultado.data);
					},
	                error: function() {
	                   
	                }, 
	                statusCode: {
	                    401: function() {
	                   
	                    }
	                }
				});
			}
			
		</script>
		
	</body>
</html>
